package ch.dao;

import ch.entity.danger;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface ddao {
    @Select("SELECT * from danger;")
    List<danger> getall();
    @Select("SELECT * from danger WHERE `name`=#{name};")
    danger getone(String name);
    @Select("SELECT * from danger WHERE id=#{id};")
    danger getonebyid(int id);
    @Update("UPDATE danger SET `name`=#{name},inputNum=#{inputNum}, outputNum=#{outputNum}, handleNum=#{handleNum}, handleCompain=#{handleCompain} , date =#{date} WHERE id=#{id};")
    boolean setone(danger danger);
    @Insert("INSERT INTO danger(`name`,inputNum,outputNum,handleNum,handleCompain,date) VALUE(#{name},#{inputNum},#{outputNum},#{handleNum},#{handleCompain},#{date});")
    boolean insertone(danger danger);
}
